{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Line chart with Confidence Interval Band\n",
    "========================================\n",
    "This example shows how to make a line chart with a bootstrapped 95% confidence interval band.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import altair as alt\n",
    "alt.data_transformers.enable('json')\n",
    "from vega_datasets import data\n",
    "\n",
    "cars = data.cars()\n",
    "\n",
    "line = alt.Chart(cars).mark_line().encode(\n",
    "    x='Year',\n",
    "    y='mean(Miles_per_Gallon)'\n",
    ")\n",
    "\n",
    "confidence_interval = alt.Chart(cars).mark_area(opacity=0.3).encode(\n",
    "    x='Year',\n",
    "    y=alt.Y('ci0(Miles_per_Gallon)', axis=alt.Axis(title='Miles/Gallon')),\n",
    "    y2='ci1(Miles_per_Gallon)'\n",
    ")\n",
    "\n",
    "confidence_interval + line\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "env": {},
   "interrupt_mode": "signal",
   "language": "python",
   "metadata": {},
   "name": "python3"
  },
  "language": "python"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
